#include "timer_app.h"
#include "reg24le1.h"

#define ONE_STEP  33333

void io_init(void)
{

CLKCTRL = 0x28;			// Clock sourced by XCOSC16M  	
CLKLFCTRL = 0x01; 		// RCOSC32K 

P1=0X00; //ALL LOW
P1CON=0X00;//NORMAL DRIVE
P1DIR=0X00;	//OUTPUT
						 
}


void timer_init(void)
{
TMOD=0X01;
TH0=(65536-ONE_STEP)/256;
TL0=(65536-ONE_STEP)%256;
ET0=1;
EA=1;
TR0=1;
}

void sev_timer0() interrupt 1
{
static unsigned char count=0;	//static
TH0=(65536-ONE_STEP)/256;
TL0=(65536-ONE_STEP)%256;
count++;
if(count==20)	//0.5s term
{
count=0;
led0=!led0;//only one bit 
}

}